<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<link rel="stylesheet" type="text/css"
		href="#{facesContext.externalContext.requestContextPath}/template/css.css"
		media="all" />
	<title>QueroTeto</title>

</h:head>
<h:body>
	<div id="corpo">
		<ui:include src="/template/topo.xhtml" />
		<ui:include src="/template/menu.xhtml" />

		<div id="conteudo">
			<p:messages id="messages" showDetail="true" autoUpdate="true"
				closable="true" globalOnly="true" />
			<div id="centro">
				#{cadastroServicoBean.msg}

				<h:form id="form">

					<p:panel header="Edição de serviço">

						<h:panelGrid columns="3" cellpadding="5">

							<h:outputText value="Nome do serviço:" />
							<p:inputText id="nome"
								value="#{cadastroServicoBean.servico.nome}" required="true" />
							<p:message for="nome" display="icon" />


							<h:outputText value="Gênero: " />
							<p:selectOneMenu value="#{cadastroServicoBean.servico.genero}">
								<f:selectItem itemLabel="--Selecione--" itemValue="" />
								<f:selectItem itemLabel="Alimentação" itemValue="alimentacao" />
								<f:selectItem itemLabel="Lazer" itemValue="lazer" />
								<f:selectItem itemLabel="Saúde" itemValue="saude" />
								<f:selectItem itemLabel="Mercado" itemValue="mercado" />
								<f:selectItem itemLabel="Lojas em geral"
									itemValue="lojas em geral" />
								<f:selectItem itemLabel="Necessidade doméstica"
									itemValue="necessidade domestica" />
							</p:selectOneMenu>
							<br />

							<h:outputText value="Rua: " />
							<p:inputText value="#{cadastroServicoBean.servico.rua}"
								required="true" id="rua" />
							<p:message for="rua" display="icon" />

							<h:outputText value="Bairro: " />
							<p:inputText value="#{cadastroServicoBean.servico.bairro}"
								required="true" id="bairro" />
							<p:message for="bairro" display="icon" />

							<h:outputText value="Número: " />
							<p:inputText value="#{cadastroServicoBean.servico.numero}"
								required="true" id="numero" />
							<p:message for="numero" display="icon" />

							<h:outputText value="Complemento: " />
							<p:inputText value="#{cadastroServicoBean.servico.referencia}"
								required="true" id="complemento" />
							<p:message for="complemento" display="icon" />


							<h:outputText value="Cidade" />
							<p:selectOneMenu value="#{cadastroServicoBean.servico.cidade}">
								<f:selectItem itemLabel="--Selecione--" itemValue="" />
								<f:selectItem itemLabel="Quixadá" itemValue="quixada" />
								<f:selectItem itemLabel="Iguatu" itemValue="iguatu" />
								<f:selectItem itemLabel="Sobral" itemValue="sobral" />
								<f:selectItem itemLabel="Pacajus" itemValue="pacajus" />
								<f:selectItem itemLabel="Outro" itemValue="outro" />
							</p:selectOneMenu><br />

							<h:outputText value="CEP: " />
							<p:inputMask value="#{cadastroServicoBean.servico.cep}"
								mask="99999-999" id="cep" />
							<p:message for="cep" display="icon" />

							<h:outputText value="Estado: " />
							<p:inputText value="#{cadastroServicoBean.servico.estado}"
								id="estado" />
							<p:message for="estado" display="icon" />

							<h:outputText value="Email para contato: " />
							<p:inputText value="#{cadastroServicoBean.servico.email}"
								required="true" id="email">
								<f:validateRegex
									pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
							</p:inputText>
							<p:message for="email" display="icon" />


							<h:outputText value="Telefone para contato: " />
							<p:inputMask value="#{cadastroServicoBean.servico.telefone}"
								mask="(99) 9999-9999" id="TelefoneFixo" />
							<p:message for="TelefoneFixo" display="icon" />

							<h:outputText value="Descrição do serviço" />
							<p:inputTextarea id="desc"
								value="#{cadastroServicoBean.servico.descricao}" />
							<p:message for="desc" display="icon" />

						<p:commandButton value="Cancelar" type="submit" action="#{cadastroServicoBean.cancelar}" ajax="false"/>  
            			<p:commandButton value="Salvar" type="submit" action="#{cadastroServicoBean.atualizar}" ajax="false"/>
			<h:inputHidden value="#{cadastroServicoBean.servico.id}" id="idPk"/>  
						</h:panelGrid>
					</p:panel>
				</h:form>
			</div>

		</div>
		<div id="both" align="center"></div>
		<ui:include src="/template/rodape.xhtml" />
	</div>
</h:body>
</html>